package com.itheima.IoTest_1;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class test_1 {
    public static void main(String[] args) throws IOException {
       // meothd();
        FileOutputStream fos=null;
        try {
          fos =new FileOutputStream("IO\\a.txt",true);
            //true代表续写，没有true就会清空文件原来的内容
            byte b[]={96,56,48,97,100};
            fos.write(b);
        } finally {
            try {
                if(fos!=null){
                    fos.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    }

    public static void meothd() throws IOException {
        FileOutputStream fos=new FileOutputStream("D:\\itheima\\a.txt");
        fos.write(97);
        fos.write("\r\n".getBytes());//换行
         fos.write(98);
        fos.write("\r\n".getBytes());//换行
        fos.close();
    }
}
